package com.fesine.learn.service.impl;

import com.fesine.learn.dao.IDaoService;
import com.fesine.learn.po.UserInfoPo;
import com.fesine.learn.service.UserInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2017/4/14.
 */
@Service("userInfoService")
public class UserInfoServiceImpl implements UserInfoService {

    @Resource
    private IDaoService daoService;

    public int addUserInfo(UserInfoPo userInfoPo) {
        return daoService.insert(userInfoPo);
    }

    public int modifyUserInfo(UserInfoPo userInfoPo) {
        return daoService.update(userInfoPo);
    }

    public int deleteUserInfo(UserInfoPo userInfoPo) {
        return daoService.delete(userInfoPo);
    }

    public void deleteUsers(String[] ids) {
        UserInfoPo userInfoPo;
        for(String id:ids){
            userInfoPo=new UserInfoPo();
            userInfoPo.setId(id);
            daoService.delete(userInfoPo);
        }

    }

    public UserInfoPo getUserInfo(UserInfoPo userInfoPo) {
        return daoService.selectOne(userInfoPo);
    }

    public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo) {
        return daoService.selectList(userInfoPo);
    }

    public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo,int pageNo,int pageSize) {
        return daoService.selectList(userInfoPo,pageNo,pageSize);
    }

    public int getTotal(UserInfoPo userInfoPo) {
        return daoService.count(userInfoPo);
    }
}
